package org.chen.model.mongodb;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.chen.model.ImageInfo;
import org.chen.model.Section;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;

import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
//mongodb实现类
@Document(collection = "articles")
@Data
public class ArticleDocument implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;

    @Id
    private String id;
    private String title;
    private String author;
    private String category;
    private List<String> leadParagraphs;  // 导语
    private String contentHtml;           // 富文本内容 - MongoDB中存储
    private List<ImageInfo> images;       // 图片信息
    private String thumbnailUrl;
    private String mainImageUrl;
    private String timestamp;
    private String source;                // admin/crawler
    private Integer status;              // 0 草稿/1发布/2下架
    private String summary;     // 摘要
    private Long viewCount;
    private List<String> tags;
    private Boolean isTop;          // 是否置顶
    private Integer topOrder;       // 置顶排序权重（数值越大越靠前）
    private Boolean isHot;          // 是否热门
    private Integer hotOrder;       // 热门排序权重
    private Boolean isRecommend;    // 是否推荐
    private Integer recommendOrder; // 推荐排序权重

    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;
}
